<?php
	function download($url) {
	$urlArr = parse_url($url);
	$fp = fsockopen($urlArr['host'], 80, $errno, $errstr, 30);
	if (!$fp) {
		echo "$errstr ($errno)<br />\n";
	} else {
		$out = "GET ".$urlArr['path']." HTTP/1.1\r\n";
	    $out .= "Host: ".$urlArr['host']."\r\n";
		$out .= "Connection: Close\r\n\r\n";
		$ret = '';
		fwrite($fp, $out);
		while (!feof($fp)) {
			$data = fgets($fp, 128);
			if(strpos($data,"GIF87") !== false || $start == 1) {
				$ret .= substr($data,strpos($data,"GIF87"));
				$start = 1;
			}
		}
		fclose($fp);
		return $ret;
	}
}
?>